﻿//04.Write a program that calculates N!/K! for given N and K (1<K<N).

using System;

namespace CalcNK
{
    class CalcNK
    {
        static void Main()
        {
            Console.Write("Enter the number K: ");
            int k = int.Parse(Console.ReadLine());
            Console.Write("Enter the number N: ");
            int n = int.Parse(Console.ReadLine());

            int factorialK = k;
            int factorialN = n;

            if (k <= 1 | n < k) 
            {
                Console.WriteLine("K should be > 1 and N should be > K.");
            }
            else 
            {
                for (int i = k-1; i > 0; i--)
                {
                    factorialK *= i;
                }

                for (int j = n-1; j > 0; j--)
                {
                    factorialN *= j;
                }

                Console.WriteLine("N! is: {0}", factorialN);
                Console.WriteLine("K! is: {0}", factorialK);
                Console.WriteLine("The result of N!/K! is: {0}.", factorialN/factorialK);
            }
         }
     }
}
